<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateOrderPayTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('order_pay', function(Blueprint $table)
		{
			$table->increments('order_pay_id');
			$table->integer('user_id')->unsigned();
			$table->string('pay_sn', 50)->comment('支付单号，(可作为总订单号)');
			$table->dateTime('create_time')->comment('创建时间啊');
			$table->boolean('pay_status')->default(0)->comment('是否已经支付，1：已支付，0未支付');
			$table->decimal('pay_price', 10)->comment('支付金额');
			$table->text('remark', 65535)->nullable();
			$table->dateTime('paid_at')->nullable()->comment('支付时间');
			$table->string('payment_no', 100)->nullable()->comment('支付平台订单号');
			$table->string('refund_no', 100)->nullable();
			$table->boolean('closed')->nullable()->default(0)->comment('订单是否已关闭');
			$table->string('ship_status')->nullable()->comment('物流状态');
			$table->text('ship_data', 65535)->nullable()->comment('物流数据');
			$table->text('extra', 65535)->nullable()->comment('其他额外数据');
			$table->integer('address_id')->nullable()->comment('地址id');
			$table->decimal('total_money', 10)->nullable()->comment('总计');
			$table->integer('total_num')->nullable()->default(0)->comment('商品数量');
			$table->string('pay_type', 100)->nullable()->default('')->comment('支付方式');
			$table->string('refund_status', 100)->nullable()->default('pending')->comment('退款状态');
			$table->string('express_company', 60)->nullable()->default('京东快递')->comment('物流公司');
			$table->string('express_no', 100)->nullable()->comment('物流单号');
			$table->string('subject', 100)->nullable();
			$table->integer('is_recharge')->nullable()->default(0)->comment('是否收购');
			$table->string('mail_no', 20)->nullable();
			$table->text('pdf_info', 65535)->nullable();
			$table->decimal('pay_balance', 10)->nullable()->default(0.00)->comment('零钱支付的钱');
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('order_pay');
	}

}
